package com.example.quartz.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.example.quartz.dao.QrtzJobDetailsMapper;
import com.example.quartz.model.QrtzJobDetails;
import com.example.quartz.service.QrtzJobDetailsService;
import com.example.quartz.utils.QuartzManager;


@Service
public class QrtzJobDetailsServiceImpl implements QrtzJobDetailsService {


	@Resource
	private QuartzManager quartzManager;
	@Resource
	private QrtzJobDetailsMapper qrtzJobDetailsDao;

	public void scheduleAll() throws Exception {
		List<QrtzJobDetails> allWithTriggers = qrtzJobDetailsDao.selectAllWithTriggers();
		for (QrtzJobDetails qrtzJobDetails : allWithTriggers) {
			quartzManager.startup(qrtzJobDetails);
		}

	}
}
